<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>

description("This tests the constructor for the GamepadEvent DOM class.");

// No initializer is passed.
shouldBe("new GamepadEvent('eventType').bubbles", "false");
shouldBe("new GamepadEvent('eventType').cancelable", "false");
shouldBeNull("new GamepadEvent('eventType').gamepad");

// bubbles is passed.
shouldBe("new GamepadEvent('eventType', { bubbles: false }).bubbles", "false");
shouldBe("new GamepadEvent('eventType', { bubbles: true }).bubbles", "true");

// cancelable is passed.
shouldBe("new GamepadEvent('eventType', { cancelable: false }).cancelable", "false");
shouldBe("new GamepadEvent('eventType', { cancelable: true }).cancelable", "true");

// gamepad is passed.
if (window.gamepadController) {
    gamepadController.connect(0);
    var gamepad = navigator.getGamepads()[0];
    shouldBe("new GamepadEvent('eventType', { gamepad: gamepad }).gamepad", "gamepad");
}
</script>
</body>
</html>
